-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate Resource Processor to internal data model #1315
Migrate Resource Processor to internal data model #1315
Conversation
5bd7fa7
to
b9838d7
Compare
Codecov Report
@@ Coverage Diff @@
## master #1315 +/- ##
=======================================
Coverage 89.61% 89.61%
=======================================
Files 215 215
Lines 15181 15185 +4
=======================================
+ Hits 13604 13608 +4
- Misses 1149 1150 +1
+ Partials 428 427 -1
Continue to review full report at Codecov.
|
bc59aed
to
4963e9e
Compare
resource/2: | ||
type: "host" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you preserve the resource type for backward compatibility, please?
I believe it will be an attribute
"opencensus.resourcetype": "host"
based on
OCAttributeResourceType = "opencensus.resourcetype" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was also thinking about it, but since we are in beta state and going through some breaking changes between releases anyway, decided to drop it right away.
But probably you right, it might be too aggressive and we can mark it as deprecated for now ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
TypeVal: "resource", | ||
NameVal: "resource", | ||
}, | ||
ResourceType: "host", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: please replace this with "opencensus.type": "host"
attribute rather than deleting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added the backward compatibility
4963e9e
to
a2bcbc2
Compare
fdb3761
to
9b40e32
Compare
"cloud.zone": "zone-1", | ||
"k8s.cluster.name": "k8s-cluster", | ||
"host.name": "k8s-node", | ||
attributes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline I think we can borrow the attribute processor actions
implementation and config for this.
BTW, if need specifically a rename
we can add it as an action so that we don't have to use upsert+delete pair all the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code was extracted and easy to use.
20c4538
to
f529c41
Compare
resource: resource, | ||
capabilities: component.ProcessorCapabilities{MutatesConsumedData: !isEmptyResource(resource)}, | ||
attrProc: attrProc, | ||
capabilities: component.ProcessorCapabilities{MutatesConsumedData: attrProc.HasActions()}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File an issue to implement same behavior as attributes span processor which fails on empty config. Or you can change this to have the same behavior.
f529c41
to
c606a7e
Compare
This commit migrates resource processor to internal data model. Existing processor configuration is relevant only to OpenCensus format, so the configuration schema has to be changed. Taking this opportunity, this commit adds existing logic for attributes manipulation from attributes processor to resource processor. New config uses "attributes" field which represents actions that can be made on resource attributes. Supported actions: INSERT, UPDATE, UPSERT, DELETE, HASH, EXTRACT. In order to migrate existing resource processor config: 1. Move key/values from "labels" field to "attributes" with action="upsert". 2. Add value from "type" field to "attributes" with key="opencensus.resourcetype" and action="upsert".
c606a7e
to
b489311
Compare
This commit migrates resource processor to internal data model. Existing processor configuration is relevant only to OpenCensus format, so the configuration schema has to be changed. Taking this opportunity, this commit adds existing logic for attributes manipulation from attributes processor to resource processor. New config uses "attributes" field which represents actions that can be made on resource attributes. Supported actions: INSERT, UPDATE, UPSERT, DELETE, HASH, EXTRACT. In order to migrate existing resource processor config: 1. Move key/values from "labels" field to "attributes" with action="upsert". 2. Add value from "type" field to "attributes" with key="opencensus.resourcetype" and action="upsert".
…etry#1315) Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.32.1 to 1.32.2. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](golangci/golangci-lint@v1.32.1...v1.32.2) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Description:
This PR migrates resource processor to internal data model.
Existing processor configuration is relevant only to OpenCensus format, so the configuration schema has to be changed. Taking this opportunity, this commit adds existing logic for attributes manipulation from attributes processor to resource processor.
New config uses "attributes" field which represents actions that can be made on resource attributes. Supported actions: INSERT, UPDATE, UPSERT, DELETE, HASH, EXTRACT.
In order to migrate existing resource processor config:
Link to tracking Issue:
Resolves: #1307
Testing:
Added unit tests